/**
 * 
 */
package neptune.web.server.operations;

import it.robertobifulco.ias.IncorrectParamsException;
import it.robertobifulco.ias.Operation;
import neptune.web.server.ApplicationManager;
import neptune.web.server.repository.ApplicationRepository;

/**
 * @author Roberto Bifulco [info@robertobifulco.it, robertobifulco.it]
 * 
 */
public class RemoveUser implements Operation {

	public static String ID = "RemoveUser";

	/*
	 * (non-Javadoc)
	 * 
	 * @see it.robertobifulco.ias.Operation#execute(java.lang.Object[])
	 */
	public Object[] execute(Object[] args) throws IncorrectParamsException,
			Exception {

		ApplicationRepository repo = ApplicationManager.getApplicationManager()
				.getApplicationRepository();
		boolean isRemoved=false;
		if (repo != null)
		{
			isRemoved = repo.removeUserByName((String) args[0]);
		}
		return new Object[]{ new Boolean(isRemoved) };
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see it.robertobifulco.ias.Operation#getDescription()
	 */
	public String getDescription() {
		return "Remove a User from the users'repository";
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see it.robertobifulco.ias.Operation#getID()
	 */
	public String getID() {
		return ID;
	}

}
